package com.wan37.logic.listener.handler;

import com.wan37.logic.global.reference.SpringContextHolder;
import com.wan37.logic.listener.annotation.EventHandler;
import com.wan37.logic.listener.annotation.Listener;
import com.wan37.logic.listener.event.EventType;
import com.wan37.logic.listener.event.user.UserLogoutEvent;
import com.wan37.logic.service.cache.UserServiceCache;
import com.wan37.logic.team.TeamManager;
import com.wan37.logic.team.cache.TeamCache;
import com.wan37.logic.team.domain.vo.TeamVO;
import com.wan37.logic.team.handler.CGameTeamHandler;

/**
 * @author : luoyong
 * @date : 2020-07-30 20:59
 **/
@Listener
public class TeamListenerHandler {
    private TeamCache teamCache;
    private UserServiceCache userServiceCache;
    private TeamManager teamManager;
    public TeamListenerHandler(){
        this.teamCache = SpringContextHolder.getBean("teamCache");
        this.userServiceCache = SpringContextHolder.getBean("userServiceCache");
        this.teamManager = SpringContextHolder.getBean("teamManager");
    }
    @EventHandler(value = EventType.LOGOUT)
    public void logout(UserLogoutEvent userLogoutEvent){
        teamManager.out(userLogoutEvent.getUserId());
    }
}
